<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>20-Vue的事件处理</title>
</head>
<body>
<div id="app">

    <button onclick="fn1()">点我呀1~~~</button>
    <button v-on:click="fn2()">点我呀2~~~</button>
    <button @click="num++">点我呀3~~~</button><br>

    {{num}}

</div>

</body>
<script src="js/vue.js"></script>
<script>

    var vue = new Vue({
        el: "#app",
        data: {
            num: 1
        },
        methods: {
            fn2() {
                console.log("点我呀2~~~");
                this.num++;
            },
            fn3() {
                console.log("点我呀3~~~");

            }
        }
    });

    function fn1() {
        console.log("点我呀1~~~");
        vue.num++;
    }

</script>
</html>